Repository navigation
Fix/issue 1824 6 k quarterly fallback - #1825
ShengranYan wants to merge 4 commits into
Conversation
Reuse EX-99 earnings tables when recent 6-Ks have no XBRL. Keep quarterly amounts separate from change columns and retain reporting currency, scale, source and caveats. Verify TSM 0001046179-26-000726: net income TWD 763,064 million and reported EPS NT$29.43. Preserve the 10-Q and XBRL paths. Fixes dgunning#1824
|
Thanks for this, and for the TSMC ground truth. The approach is right, and I'd like to take it in 6.1, since 6.0 is frozen for new features. Before that, a few things need to change:
Smaller point: each candidate 6-K costs an XBRL probe, an index fetch and a parse of every EX-99, so a filer with many monthly notices can cost 30+ requests before returning None. Checking the attachment index for an EX-99 before parsing would cut most of that. |
|
Two more things I missed in my first pass. CI is red because The bigger one is that the HTML path returns a Once #1864 lands, the currency helpers, |
…K filer (GH #1824) (#1870) TSMC files its quarterly results on Form 6-K as an HTML press release with no XBRL, so get_quarterly_financials() returns None, which is the 6.0 contract. Neither guide said so, and the 6-K guide told readers to "parse the press release exhibits directly" without naming the reader that does it. financial-data.md gains a foreign-private-issuer section with a runnable example on TSMC's 3Q26 release (0001046179-26-000726): net income 763,064 vs 452,302, NT$ million as printed. The 6-K guide and the method docstring point to EarningsRelease.from_filing(). A regression test runs the example from a cassette recorded from live SEC. The HTML fallback itself stays in #1825 for 6.1. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
Now that #1864 is in, this can build on the |
|
Yes, I’m still working on this and will update this PR. I’ve switched the regression test from |
What this changes
Company("TSM").get_quarterly_financials()selects a monthly 6-K without XBRLand returns
None, although a slightly older 6-K links an HTML earnings table.The method now checks up to 10 recent unamended 6-Ks (configurable via
max_6k_filings), preserving the 10-Q path and giving XBRL precedence withineach candidate. Untagged EX-99 income tables reuse
EarningsRelease.The result remains a
Financials, withxb=Noneand an explicitly table-backedincome statement. Quarterly amount columns are ordered by period; percent-change,
annual/YTD and ambiguous columns are not promoted to quarterly amounts. Reporting
currency, scale, source URL and nearby caveats remain available. Scalar income
getters and
.to_dataframe()use actual currency units; EPS stays unscaled.Other statements remain unavailable and no XBRL facts are synthesized.
HTML
.to_dataframe()now has the same parameter signature and non-periodcolumns as the XBRL
Statementconverter. Original labels stay unchanged;conceptand unavailable hierarchy/linkbase metadata are null. Unambiguousexact HTML labels map to existing
standard_conceptidentifiers, with theirHTML origin recorded in DataFrame attributes. Generic net income does not
establish parent attribution and generic EPS does not establish basic/diluted
EPS; these stay unmapped. Adjusted/non-GAAP EPS is not promoted to GAAP EPS.
include_unit,include_point_in_time,standardand the legacyinclude_standardizationflag follow the documented export behavior.period_filterselects an exact reported comparison header, preserving itsfiscal label rather than fabricating calendar dates. Invalid/unknown arguments
raise. Explicit dimensional/period views, raw XBRL signs and matrix requests
raise
NotImplementedErrorrather than being silently ignored.Fixes #1824
Verification
0001046179-26-000726, filed October 15, 2026,exhibit
a3q26e_withguidancexfinal.htm: net income TWD 763,064 million,revenue TWD 1,494,243 million, reported EPS NT$29.43. The latest
monthly notice
0001046179-26-000728must not be accepted as an income statement.tests/issues/regression/test_issue_1824.pylinks theissue and checks these amounts, comparison columns, scale, currency, unscaled
EPS, Board-approval footnote, bounded selection and unchanged XBRL/10-Q paths.
Additional checks compare the actual TSM HTML and existing NVDA XBRL fixture
(
0001045810-26-000021) across export flags and verify column order, signature,units, null source metadata, conservative mappings, filtering, no mutation and
explicit failures for unavailable operations.
November 1, 2026 before implementation, saved unchanged with source URLs and
SHA-256 hashes. No VCR cassettes were added or edited.
ValueError; transporterrors propagate. Absence of a supported table remains the documented
None.are documented in
docs/guides/financial-data.md.changelog.d/1824.added.md.Current focused verification: 165 passed, 4 deselected, including the
income-table parser, issue-1824 regression tests and unchanged no-XBRL behavior.
Four new interface regressions also fail against the original local commit
5e589d0, checking the signature, metadata/units, filtering and invalid arguments.This baseline probe loads the original source in a separate process and does not
switch or alter the working tree. Test environment uses vcrpy 8.3.0, within the
project's declared range. The initially resolved 8.5.0 fixes the upstream VCR
bug itself, so main's obsolete "compat fix is still needed" guard fails there;
no test or dependency declaration was edited to work around it.
Final
hatch run test-fast: 50,392 passed, 9 skipped, 3,416 deselected,1 xfailed, 30 warnings, 1 rerun, exit code 0 in 584.34s.
The existing
test_get_icon_valid_tickerhit aReadTimeoutand passed onattempt 2 under the repository's normal retry settings. No retry settings or
assertions were changed. An earlier revision run was stopped to tighten the
adjusted-EPS boundary and is not counted as a completed test run.
Run with
NO_COLORunset andTERM=xterm-256color: the tool shell's defaults(
NO_COLOR=1,TERM=dumb) otherwise disable ANSI highlights and fail threeunmodified search-rendering tests. Those three also pass independently under
the normal terminal settings. No tests were weakened, deleted or newly skipped.
Global
hatch run lintreports 1,055 existing findings; the new adapter and regressiontest pass Ruff and the modified entity module adds no findings over main.
The local live smoke compared the original main method
at
3931b22077eee1e0d2b77a8c5a61ab415d51ae0b(returnsNone) with thisimplementation (returns TWD 763,064,000,000 and the correct exhibit).
The final revision was also called through
Company('TSM'): it selected thesame earnings exhibit and exported
twd/twdPerSharerow units, duration flags,null source concepts and the four unambiguous income mappings correctly.
The original amount assertions still check every reported comparison value;
they explicitly select period columns now that the export also includes metadata.
Scope
This is a bounded HTML income-statement enhancement, not a general HTML/PDF
financial-statement parser or a promise of quarterly coverage for every issuer.
No dependencies, shared XBRL concept-mapping files,
Financials.extract()semantics, or frozenFiling/Attachmentcontracts are changed. No new deprecation or removal.AI assistance
Working context
Verified the primary 6-K's actual exhibit link, the live before/after result, the unit declaration before
the table, interleaved YoY/QoQ columns and the current-quarter Board-approval
caveat. Tests also reject unknown currency and narrative-only unit guesses.